home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / DAs, INITs, CDEVs, etc / Mr. Bus Error / Short Description < prev   
Text File  |  2022-08-05  |  938b  |  3 lines

  1. Mr. Bus Error is an INIT which causes a bus error if you try to dereference memory location 0.  So why would you want to do this?  Its a great way to help track down bugs, by forcing a crash closer to the code which actually contains the bug.
  2.  
  3. One of the most common Macintosh programming errors is asking for a handle to memory, and then writing to it without checking to see if you actually got it or not.  If you don't get the memory (there wasn't enough memory left), the system returns 0 instead.  If you dereference zero and start writing, you're likely to crash the system, but often not until later, when you try to use the (random) piece of memory which was overwritten.  Mr. Bus Error forces you to get a bus error (on 68020 and 68030) or address error (on 68000) when you try to write to where memory location 0 points.  It dies this by setting up a VBL task which puts a number into 0 which is both odd and not in real memory.